package com.ytjj.qmyx.admin.service.impl;

import com.ytjj.common.api.CommonPage;
import com.ytjj.qmyx.admin.dao.PayStatisticsDao;
import com.ytjj.qmyx.admin.model.request.PayStatisticsRequest;
import com.ytjj.qmyx.admin.service.PayStatisticsService;
import com.ytjj.qmyx.mall.model.PayStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 *
 *
 * @Version: 1.0
 */
@Service
public class PayStatisticsServiceImpl implements PayStatisticsService {

    @Autowired
    private PayStatisticsDao payStatisticsDao;

    @Override
    public List<PayStatistics> getPayStatisticsList(PayStatisticsRequest payStatisticsRequest) {
        String sTime = payStatisticsRequest.getDayTime() + " 00:00:00";
        String eTime = payStatisticsRequest.getDayTime() + " 23:59:59";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            Date startTime = sdf.parse(sTime);
            Date endTime = sdf.parse(eTime);
            payStatisticsRequest.setStartTime(startTime);
            payStatisticsRequest.setEndTime(endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return payStatisticsDao.getPayStatisticsList(payStatisticsRequest);
    }

}
